﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Abs_classes_data;

namespace Conc_classes_data
{
    public class tank : abs_controlled_object
    {
        private Double _pressure;
        public Double Pressure
        {
            get { return _pressure; }
            set { _pressure = value; }
        }

        private Double _temperature;
        public Double Temperature
        {
            get { return _temperature; }
            set { _temperature = value; }
        }

        private Double _total_volume = 2000;
        public Double Total_Volume
        {
            get { return _total_volume; }
        }

        private Double _current_volume;
        public Double Current_volume
        {
            get { return _current_volume; }
            set { _current_volume = value; }
        }
        
        public tank(Double start_volume)
        {
            if (start_volume < _total_volume)
            {
                _current_volume = start_volume;
                _pressure = 300;
            }
        }

        public void Get_Gas(Double volume)
        {
            Double tmp = _current_volume - volume;
            _current_volume = (tmp > 0 ? tmp : 0);
            //_current_volume -= volume;
        }

        public void Refill()
        {
            _current_volume = Total_Volume;
        }

        public void Repair_Pressure()
        {
            _pressure = 300;
        }

        public void Repair_Temperature()
        {
            _temperature = 60;
        }

        public override Double Get_Data()
        {
            return _current_volume;
        }
    }
}
